# def pixel2world(pixel_coord:tuple):
#     #像素点转世界点
#     robot_home = (805,695)
#     #688 1057 --> 300mm -->369
#     ratio = 1.23
#     x,y = pixel_coord
#     x = x-robot_home[0]
#     y = -y+robot_home[1]
#     return (int(x/ratio),int(y/ratio))
# if __name__=="__main__":
#     print(pixel2world((860,268)))

# import numpy as np
# a = np.array([[1,2,3,4],[4,5,6,7]])

# b=a.copy()
# b[:, [ 0 , 2 ]] = b[:, [ 2 , 0 ]]#交换两列
# print(a)
# print(b)
# print(np.concatenate((a,b),axis=1))
# b = np.array([[1,2,3,4],[4,5,6,7]])
# c = np.concatenate((a,b),axis=1)
# print(c)


import numpy as np
# a = np.array([1,2,3,4,4,5,6,7])
# b = np.array([1,1,1,1,1,1,1,1])
# c= abs(a-b)
# print(c)
# print(len(a))
# b = [(np.array([c[i],c[i+1]])<5).all() for i in range(0,len(c),2)]
# print(b)
# print(np.array(b).sum())

edge = np.array([50,100,150,30])
edge_flag = np.array([True,True,False,False])
result = {"labels":np.array([1,2,3,4]),"scores":np.array([0.5,0.3,0.5,0.6]),"bboxes":np.array([[100,100,100,100],[110,110,110,110],[120,120,120,120],[130,130,130,130]])}
print(result["labels"]>1)
print(result["labels"][result["labels"]>1])
labels = np.array([1,2,3,4])
bboxes = np.array([[100,110,100,10],[110,110,110,110],[120,120,120,120],[130,130,130,130]])
filter_edge = np.array([],dtype=np.bool_)
# filter_edge.tobytes
for b in bboxes:
    filter_edge = np.append(filter_edge,np.array_equal(edge_flag,(b-edge)>0))
print(filter_edge)
print(labels[filter_edge])